package com.dingding.manager.modules.system.sql;

public class RoleSQL {
	
	/**
	 * 根据用户名获取角色信息 SUNZHICHENG
	 */
	public static final String QUERY_ROLE_BY_USERNAME=" SELECT a.* FROM dd_sys_role a ,dd_sys_user_role b, dd_sys_user c  where a.sysRoleId = b.sysRoleId and b.sysUserId = c.sysUserId and  c.loginName = ? AND a.delFlag = 0 and a.roleStatus = 1";
	
	/**
	 * 查询所有角色
	 */
	public static final String QUERY_ROLELIST=" SELECT a.* FROM dd_sys_role a where a.delFlag = 0 AND a.roleStatus = 1 ";
	
	/**
	 * 按id查询角色详情
	 */
	public static final String ROLE_INFO=" select a.sysRoleId sysRoleId, a.roleName roleName,a.roleEnName roleEnName,a.roleType roleType,a.roleStatus roleStatus,a.dataScope dataScope,a.createUserId createUserId,DATE_FORMAT(a.createTime,'%Y-%m-%d %H:%I:%S') createTime,a.updateUserId updateUserId,DATE_FORMAT(a.updateTime,'%Y-%m-%d %H:%I:%S') updateTime,a.remarks remarks FROM dd_sys_role a  WHERE a.delFlag = 0 AND a.sysRoleId = ?  ";
	
	/**
	 * 根据角色英文名获取角色信息
	 */
	public static final String QUERY_ROLES_BY_ROLENAME=" SELECT * FROM dd_sys_role a WHERE a.roleEnName = ? OR a.roleName = ? ";
	
	/**
	 * 根据角色id获取角色菜单关联
	 */
	public static final String QUERY_ROLEMENU_BY_ROLEID=" SELECT * FROM dd_sys_role_menu a WHERE a.sysRoleId = ?  ";
}
